#pragma once
// MESSAGE SET_PID4 PACKING

#define MAVLINK_MSG_ID_SET_PID4 194

MAVPACKED(
typedef struct __mavlink_set_pid4_t {
 int16_t pid10_p; /*<  PID10_P*/
 int16_t pid10_i; /*<  PID10_I*/
 int16_t pid10_d; /*<  PID10_D*/
 int16_t pid11_p; /*<  PID11_P*/
 int16_t pid11_i; /*<  PID11_I*/
 int16_t pid11_d; /*<  PID11_D*/
 int16_t pid12_p; /*<  PID12_P*/
 int16_t pid12_i; /*<  PID12_I*/
 int16_t pid12_d; /*<  PID12_D*/
}) mavlink_set_pid4_t;

#define MAVLINK_MSG_ID_SET_PID4_LEN 18
#define MAVLINK_MSG_ID_SET_PID4_MIN_LEN 18
#define MAVLINK_MSG_ID_194_LEN 18
#define MAVLINK_MSG_ID_194_MIN_LEN 18

#define MAVLINK_MSG_ID_SET_PID4_CRC 240
#define MAVLINK_MSG_ID_194_CRC 240



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_SET_PID4 { \
    194, \
    "SET_PID4", \
    9, \
    {  { "pid10_p", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_set_pid4_t, pid10_p) }, \
         { "pid10_i", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_pid4_t, pid10_i) }, \
         { "pid10_d", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_pid4_t, pid10_d) }, \
         { "pid11_p", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_set_pid4_t, pid11_p) }, \
         { "pid11_i", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_set_pid4_t, pid11_i) }, \
         { "pid11_d", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_set_pid4_t, pid11_d) }, \
         { "pid12_p", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_set_pid4_t, pid12_p) }, \
         { "pid12_i", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_set_pid4_t, pid12_i) }, \
         { "pid12_d", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_set_pid4_t, pid12_d) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_SET_PID4 { \
    "SET_PID4", \
    9, \
    {  { "pid10_p", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_set_pid4_t, pid10_p) }, \
         { "pid10_i", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_pid4_t, pid10_i) }, \
         { "pid10_d", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_pid4_t, pid10_d) }, \
         { "pid11_p", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_set_pid4_t, pid11_p) }, \
         { "pid11_i", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_set_pid4_t, pid11_i) }, \
         { "pid11_d", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_set_pid4_t, pid11_d) }, \
         { "pid12_p", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_set_pid4_t, pid12_p) }, \
         { "pid12_i", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_set_pid4_t, pid12_i) }, \
         { "pid12_d", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_set_pid4_t, pid12_d) }, \
         } \
}
#endif

/**
 * @brief Pack a set_pid4 message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param pid10_p  PID10_P
 * @param pid10_i  PID10_I
 * @param pid10_d  PID10_D
 * @param pid11_p  PID11_P
 * @param pid11_i  PID11_I
 * @param pid11_d  PID11_D
 * @param pid12_p  PID12_P
 * @param pid12_i  PID12_I
 * @param pid12_d  PID12_D
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_set_pid4_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               int16_t pid10_p, int16_t pid10_i, int16_t pid10_d, int16_t pid11_p, int16_t pid11_i, int16_t pid11_d, int16_t pid12_p, int16_t pid12_i, int16_t pid12_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID4_LEN];
    _mav_put_int16_t(buf, 0, pid10_p);
    _mav_put_int16_t(buf, 2, pid10_i);
    _mav_put_int16_t(buf, 4, pid10_d);
    _mav_put_int16_t(buf, 6, pid11_p);
    _mav_put_int16_t(buf, 8, pid11_i);
    _mav_put_int16_t(buf, 10, pid11_d);
    _mav_put_int16_t(buf, 12, pid12_p);
    _mav_put_int16_t(buf, 14, pid12_i);
    _mav_put_int16_t(buf, 16, pid12_d);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_PID4_LEN);
#else
    mavlink_set_pid4_t packet;
    packet.pid10_p = pid10_p;
    packet.pid10_i = pid10_i;
    packet.pid10_d = pid10_d;
    packet.pid11_p = pid11_p;
    packet.pid11_i = pid11_i;
    packet.pid11_d = pid11_d;
    packet.pid12_p = pid12_p;
    packet.pid12_i = pid12_i;
    packet.pid12_d = pid12_d;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_PID4_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_SET_PID4;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_PID4_MIN_LEN, MAVLINK_MSG_ID_SET_PID4_LEN, MAVLINK_MSG_ID_SET_PID4_CRC);
}

/**
 * @brief Pack a set_pid4 message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param pid10_p  PID10_P
 * @param pid10_i  PID10_I
 * @param pid10_d  PID10_D
 * @param pid11_p  PID11_P
 * @param pid11_i  PID11_I
 * @param pid11_d  PID11_D
 * @param pid12_p  PID12_P
 * @param pid12_i  PID12_I
 * @param pid12_d  PID12_D
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_set_pid4_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   int16_t pid10_p,int16_t pid10_i,int16_t pid10_d,int16_t pid11_p,int16_t pid11_i,int16_t pid11_d,int16_t pid12_p,int16_t pid12_i,int16_t pid12_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID4_LEN];
    _mav_put_int16_t(buf, 0, pid10_p);
    _mav_put_int16_t(buf, 2, pid10_i);
    _mav_put_int16_t(buf, 4, pid10_d);
    _mav_put_int16_t(buf, 6, pid11_p);
    _mav_put_int16_t(buf, 8, pid11_i);
    _mav_put_int16_t(buf, 10, pid11_d);
    _mav_put_int16_t(buf, 12, pid12_p);
    _mav_put_int16_t(buf, 14, pid12_i);
    _mav_put_int16_t(buf, 16, pid12_d);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_PID4_LEN);
#else
    mavlink_set_pid4_t packet;
    packet.pid10_p = pid10_p;
    packet.pid10_i = pid10_i;
    packet.pid10_d = pid10_d;
    packet.pid11_p = pid11_p;
    packet.pid11_i = pid11_i;
    packet.pid11_d = pid11_d;
    packet.pid12_p = pid12_p;
    packet.pid12_i = pid12_i;
    packet.pid12_d = pid12_d;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_PID4_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_SET_PID4;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_PID4_MIN_LEN, MAVLINK_MSG_ID_SET_PID4_LEN, MAVLINK_MSG_ID_SET_PID4_CRC);
}

/**
 * @brief Encode a set_pid4 struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param set_pid4 C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_set_pid4_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_pid4_t* set_pid4)
{
    return mavlink_msg_set_pid4_pack(system_id, component_id, msg, set_pid4->pid10_p, set_pid4->pid10_i, set_pid4->pid10_d, set_pid4->pid11_p, set_pid4->pid11_i, set_pid4->pid11_d, set_pid4->pid12_p, set_pid4->pid12_i, set_pid4->pid12_d);
}

/**
 * @brief Encode a set_pid4 struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param set_pid4 C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_set_pid4_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_pid4_t* set_pid4)
{
    return mavlink_msg_set_pid4_pack_chan(system_id, component_id, chan, msg, set_pid4->pid10_p, set_pid4->pid10_i, set_pid4->pid10_d, set_pid4->pid11_p, set_pid4->pid11_i, set_pid4->pid11_d, set_pid4->pid12_p, set_pid4->pid12_i, set_pid4->pid12_d);
}

/**
 * @brief Send a set_pid4 message
 * @param chan MAVLink channel to send the message
 *
 * @param pid10_p  PID10_P
 * @param pid10_i  PID10_I
 * @param pid10_d  PID10_D
 * @param pid11_p  PID11_P
 * @param pid11_i  PID11_I
 * @param pid11_d  PID11_D
 * @param pid12_p  PID12_P
 * @param pid12_i  PID12_I
 * @param pid12_d  PID12_D
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_set_pid4_send(mavlink_channel_t chan, int16_t pid10_p, int16_t pid10_i, int16_t pid10_d, int16_t pid11_p, int16_t pid11_i, int16_t pid11_d, int16_t pid12_p, int16_t pid12_i, int16_t pid12_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID4_LEN];
    _mav_put_int16_t(buf, 0, pid10_p);
    _mav_put_int16_t(buf, 2, pid10_i);
    _mav_put_int16_t(buf, 4, pid10_d);
    _mav_put_int16_t(buf, 6, pid11_p);
    _mav_put_int16_t(buf, 8, pid11_i);
    _mav_put_int16_t(buf, 10, pid11_d);
    _mav_put_int16_t(buf, 12, pid12_p);
    _mav_put_int16_t(buf, 14, pid12_i);
    _mav_put_int16_t(buf, 16, pid12_d);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID4, buf, MAVLINK_MSG_ID_SET_PID4_MIN_LEN, MAVLINK_MSG_ID_SET_PID4_LEN, MAVLINK_MSG_ID_SET_PID4_CRC);
#else
    mavlink_set_pid4_t packet;
    packet.pid10_p = pid10_p;
    packet.pid10_i = pid10_i;
    packet.pid10_d = pid10_d;
    packet.pid11_p = pid11_p;
    packet.pid11_i = pid11_i;
    packet.pid11_d = pid11_d;
    packet.pid12_p = pid12_p;
    packet.pid12_i = pid12_i;
    packet.pid12_d = pid12_d;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID4, (const char *)&packet, MAVLINK_MSG_ID_SET_PID4_MIN_LEN, MAVLINK_MSG_ID_SET_PID4_LEN, MAVLINK_MSG_ID_SET_PID4_CRC);
#endif
}

/**
 * @brief Send a set_pid4 message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_set_pid4_send_struct(mavlink_channel_t chan, const mavlink_set_pid4_t* set_pid4)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_set_pid4_send(chan, set_pid4->pid10_p, set_pid4->pid10_i, set_pid4->pid10_d, set_pid4->pid11_p, set_pid4->pid11_i, set_pid4->pid11_d, set_pid4->pid12_p, set_pid4->pid12_i, set_pid4->pid12_d);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID4, (const char *)set_pid4, MAVLINK_MSG_ID_SET_PID4_MIN_LEN, MAVLINK_MSG_ID_SET_PID4_LEN, MAVLINK_MSG_ID_SET_PID4_CRC);
#endif
}

#if MAVLINK_MSG_ID_SET_PID4_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_set_pid4_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  int16_t pid10_p, int16_t pid10_i, int16_t pid10_d, int16_t pid11_p, int16_t pid11_i, int16_t pid11_d, int16_t pid12_p, int16_t pid12_i, int16_t pid12_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_int16_t(buf, 0, pid10_p);
    _mav_put_int16_t(buf, 2, pid10_i);
    _mav_put_int16_t(buf, 4, pid10_d);
    _mav_put_int16_t(buf, 6, pid11_p);
    _mav_put_int16_t(buf, 8, pid11_i);
    _mav_put_int16_t(buf, 10, pid11_d);
    _mav_put_int16_t(buf, 12, pid12_p);
    _mav_put_int16_t(buf, 14, pid12_i);
    _mav_put_int16_t(buf, 16, pid12_d);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID4, buf, MAVLINK_MSG_ID_SET_PID4_MIN_LEN, MAVLINK_MSG_ID_SET_PID4_LEN, MAVLINK_MSG_ID_SET_PID4_CRC);
#else
    mavlink_set_pid4_t *packet = (mavlink_set_pid4_t *)msgbuf;
    packet->pid10_p = pid10_p;
    packet->pid10_i = pid10_i;
    packet->pid10_d = pid10_d;
    packet->pid11_p = pid11_p;
    packet->pid11_i = pid11_i;
    packet->pid11_d = pid11_d;
    packet->pid12_p = pid12_p;
    packet->pid12_i = pid12_i;
    packet->pid12_d = pid12_d;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID4, (const char *)packet, MAVLINK_MSG_ID_SET_PID4_MIN_LEN, MAVLINK_MSG_ID_SET_PID4_LEN, MAVLINK_MSG_ID_SET_PID4_CRC);
#endif
}
#endif

#endif

// MESSAGE SET_PID4 UNPACKING


/**
 * @brief Get field pid10_p from set_pid4 message
 *
 * @return  PID10_P
 */
static inline int16_t mavlink_msg_set_pid4_get_pid10_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  0);
}

/**
 * @brief Get field pid10_i from set_pid4 message
 *
 * @return  PID10_I
 */
static inline int16_t mavlink_msg_set_pid4_get_pid10_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  2);
}

/**
 * @brief Get field pid10_d from set_pid4 message
 *
 * @return  PID10_D
 */
static inline int16_t mavlink_msg_set_pid4_get_pid10_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  4);
}

/**
 * @brief Get field pid11_p from set_pid4 message
 *
 * @return  PID11_P
 */
static inline int16_t mavlink_msg_set_pid4_get_pid11_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  6);
}

/**
 * @brief Get field pid11_i from set_pid4 message
 *
 * @return  PID11_I
 */
static inline int16_t mavlink_msg_set_pid4_get_pid11_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  8);
}

/**
 * @brief Get field pid11_d from set_pid4 message
 *
 * @return  PID11_D
 */
static inline int16_t mavlink_msg_set_pid4_get_pid11_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  10);
}

/**
 * @brief Get field pid12_p from set_pid4 message
 *
 * @return  PID12_P
 */
static inline int16_t mavlink_msg_set_pid4_get_pid12_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  12);
}

/**
 * @brief Get field pid12_i from set_pid4 message
 *
 * @return  PID12_I
 */
static inline int16_t mavlink_msg_set_pid4_get_pid12_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  14);
}

/**
 * @brief Get field pid12_d from set_pid4 message
 *
 * @return  PID12_D
 */
static inline int16_t mavlink_msg_set_pid4_get_pid12_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  16);
}

/**
 * @brief Decode a set_pid4 message into a struct
 *
 * @param msg The message to decode
 * @param set_pid4 C-struct to decode the message contents into
 */
static inline void mavlink_msg_set_pid4_decode(const mavlink_message_t* msg, mavlink_set_pid4_t* set_pid4)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    set_pid4->pid10_p = mavlink_msg_set_pid4_get_pid10_p(msg);
    set_pid4->pid10_i = mavlink_msg_set_pid4_get_pid10_i(msg);
    set_pid4->pid10_d = mavlink_msg_set_pid4_get_pid10_d(msg);
    set_pid4->pid11_p = mavlink_msg_set_pid4_get_pid11_p(msg);
    set_pid4->pid11_i = mavlink_msg_set_pid4_get_pid11_i(msg);
    set_pid4->pid11_d = mavlink_msg_set_pid4_get_pid11_d(msg);
    set_pid4->pid12_p = mavlink_msg_set_pid4_get_pid12_p(msg);
    set_pid4->pid12_i = mavlink_msg_set_pid4_get_pid12_i(msg);
    set_pid4->pid12_d = mavlink_msg_set_pid4_get_pid12_d(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_SET_PID4_LEN? msg->len : MAVLINK_MSG_ID_SET_PID4_LEN;
        memset(set_pid4, 0, MAVLINK_MSG_ID_SET_PID4_LEN);
    memcpy(set_pid4, _MAV_PAYLOAD(msg), len);
#endif
}
